package reflect;

import reflect.annotations.AutoRunClass;

import java.util.MissingFormatArgumentException;

/*
* 反射机制访问注释
* */
public class ReflectDemo11 {
    public static void main(String[] args) throws ClassNotFoundException {
        //访问Person类上是否存在注解@AutoRunClass
        //1.获取Person类
        Class cls = Class.forName("reflect.Person");
        //判断该类是否被标注了注解
        boolean mark = cls.isAnnotationPresent(AutoRunClass.class);
        if (mark){
            System.out.println("有注解");

        }else {
            System.out.println("没有注解");
        }
    }
}
